.class public Lcom/zuiapps/suite/utils/device/BluetoothUtil;
.super Ljava/lang/Object;
.source "BluetoothUtil.java"


# instance fields
.field private mBluetoothAdapter:Landroid/bluetooth/BluetoothAdapter;

.field private mContext:Landroid/content/Context;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 16
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 17
    iput-object p1, p0, Lcom/zuiapps/suite/utils/device/BluetoothUtil;->mContext:Landroid/content/Context;

    .line 18
    invoke-static {}, Landroid/bluetooth/BluetoothAdapter;->getDefaultAdapter()Landroid/bluetooth/BluetoothAdapter;

    move-result-object v0

    iput-object v0, p0, Lcom/zuiapps/suite/utils/device/BluetoothUtil;->mBluetoothAdapter:Landroid/bluetooth/BluetoothAdapter;

    .line 19
    return-void
.end method


# virtual methods
.method public getBluetoothStatus()I
    .registers 2

    .prologue
    .line 23
    :try_start_0
    iget-object v0, p0, Lcom/zuiapps/suite/utils/device/BluetoothUtil;->mBluetoothAdapter:Landroid/bluetooth/BluetoothAdapter;

    if-nez v0, :cond_6

    .line 24
    const/4 v0, 0x0

    .line 30
    :goto_5
    return v0

    .line 26
    :cond_6
    iget-object v0, p0, Lcom/zuiapps/suite/utils/device/BluetoothUtil;->mBluetoothAdapter:Landroid/bluetooth/BluetoothAdapter;

    invoke-virtual {v0}, Landroid/bluetooth/BluetoothAdapter;->getState()I
    :try_end_b
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_b} :catch_d

    move-result v0

    goto :goto_5

    .line 27
    :catch_d
    move-exception v0

    .line 30
    const/16 v0, 0xa

    goto :goto_5
.end method

.method public redictToSettings()V
    .registers 3

    .prologue
    .line 72
    :try_start_0
    new-instance v0, Landroid/content/Intent;

    const-string v1, "android.settings.BLUETOOTH_SETTINGS"

    invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 73
    .local v0, "settings":Landroid/content/Intent;
    const/high16 v1, 0x10000000

    invoke-virtual {v0, v1}, Landroid/content/Intent;->setFlags(I)Landroid/content/Intent;

    .line 74
    iget-object v1, p0, Lcom/zuiapps/suite/utils/device/BluetoothUtil;->mContext:Landroid/content/Context;

    invoke-virtual {v1, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V
    :try_end_11
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_11} :catch_12

    .line 78
    .end local v0    # "settings":Landroid/content/Intent;
    :goto_11
    return-void

    .line 75
    :catch_12
    move-exception v1

    goto :goto_11
.end method

.method public setBluetoothStatus()Z
    .registers 4

    .prologue
    .line 35
    :try_start_0
    invoke-virtual {p0}, Lcom/zuiapps/suite/utils/device/BluetoothUtil;->getBluetoothStatus()I

    move-result v2

    packed-switch v2, :pswitch_data_48

    .line 62
    :cond_7
    const/4 v2, 0x1

    .line 67
    :goto_8
    return v2

    .line 38
    :pswitch_9
    iget-object v2, p0, Lcom/zuiapps/suite/utils/device/BluetoothUtil;->mBluetoothAdapter:Landroid/bluetooth/BluetoothAdapter;

    invoke-virtual {v2}, Landroid/bluetooth/BluetoothAdapter;->disable()Z

    move-result v1

    .line 39
    .local v1, "isSucc":Z
    if-nez v1, :cond_7

    .line 40
    new-instance v2, Ljava/lang/Exception;

    invoke-direct {v2}, Ljava/lang/Exception;-><init>()V

    throw v2
    :try_end_17
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_17} :catch_17

    .line 63
    .end local v1    # "isSucc":Z
    :catch_17
    move-exception v0

    .line 64
    .local v0, "e":Ljava/lang/Exception;
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    .line 67
    const/4 v2, 0x0

    goto :goto_8

    .line 44
    .end local v0    # "e":Ljava/lang/Exception;
    :pswitch_1d
    :try_start_1d
    iget-object v2, p0, Lcom/zuiapps/suite/utils/device/BluetoothUtil;->mBluetoothAdapter:Landroid/bluetooth/BluetoothAdapter;

    invoke-virtual {v2}, Landroid/bluetooth/BluetoothAdapter;->disable()Z

    move-result v1

    .line 45
    .restart local v1    # "isSucc":Z
    if-nez v1, :cond_7

    .line 46
    new-instance v2, Ljava/lang/Exception;

    invoke-direct {v2}, Ljava/lang/Exception;-><init>()V

    throw v2

    .line 50
    .end local v1    # "isSucc":Z
    :pswitch_2b
    iget-object v2, p0, Lcom/zuiapps/suite/utils/device/BluetoothUtil;->mBluetoothAdapter:Landroid/bluetooth/BluetoothAdapter;

    invoke-virtual {v2}, Landroid/bluetooth/BluetoothAdapter;->enable()Z

    move-result v1

    .line 51
    .restart local v1    # "isSucc":Z
    if-nez v1, :cond_7

    .line 52
    new-instance v2, Ljava/lang/Exception;

    invoke-direct {v2}, Ljava/lang/Exception;-><init>()V

    throw v2

    .line 56
    .end local v1    # "isSucc":Z
    :pswitch_39
    iget-object v2, p0, Lcom/zuiapps/suite/utils/device/BluetoothUtil;->mBluetoothAdapter:Landroid/bluetooth/BluetoothAdapter;

    invoke-virtual {v2}, Landroid/bluetooth/BluetoothAdapter;->enable()Z

    move-result v1

    .line 57
    .restart local v1    # "isSucc":Z
    if-nez v1, :cond_7

    .line 58
    new-instance v2, Ljava/lang/Exception;

    invoke-direct {v2}, Ljava/lang/Exception;-><init>()V

    throw v2
    :try_end_47
    .catch Ljava/lang/Exception; {:try_start_1d .. :try_end_47} :catch_17

    .line 35
    nop

    :pswitch_data_48
    .packed-switch 0xa
        :pswitch_2b
        :pswitch_1d
        :pswitch_9
        :pswitch_39
    .end packed-switch
.end method
